package ch01.factory;

/**
 * Created by zc on 2016/10/25.
 */
public class Factory {
    private static Factory factory;
    private static Object classLock = Factory.class;

    private long wipMoves;

    public Factory() {
        this.wipMoves = 0;
    }

    public static Factory getFactory(){
        synchronized (classLock){
            if(factory==null){
                factory = new Factory();
            }
            return factory;
        }
    }

    public void recordwipMove() {
        System.out.println("move: " + wipMoves++);
    }
}
